<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<base href="<%=basePath%>">
<head>
<meta charset="utf-8">
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1">
<link rel="stylesheet"
	href="static/bootstrap-3.3.7-dist/css/bootstrap.min.css">
<!-- bootstrapValidator -->
<link rel="stylesheet" href="static/bootstrap-3.3.7-dist/css/bootstrapValidator.min.css">
<link rel="stylesheet" type="text/css"
	href="static/assets/css/bootstrap-clearmin.min.css">
<link rel="stylesheet" href="static/sweealter/dist/sweetalert.css">
<link rel="stylesheet" type="text/css"
	href="static/assets/css/roboto.css">
<link rel="stylesheet" type="text/css"
	href="static/assets/css/material-design.css">
<link rel="stylesheet" type="text/css"
	href="static/assets/css/small-n-flat.css">
<link rel="stylesheet" type="text/css"
	href="static/assets/css/font-awesome.min.css">
<link rel="stylesheet" href="static/ztree/zTreeStyle.css">
<link rel="stylesheet"
	href="static/bootstrap-table/bootstrap-table.min.css">
<link rel="stylesheet" href="static/bootstrap-table/jquery.treegrid.css">
<link rel="stylesheet" href="static/plugins/jquery-ui/jquery-ui.min.css">
<link rel="stylesheet" href="static/plugins/uploadfile/css/uploadfile.css">
<title>Clearmin template</title>
<style>
.boxleft {
	height: 655px;
	width: 100%;
	margin-top: 15px;
	border: 1px solid #e5e5e5;
	border-radius: 4px;
}

.mar {
	margin-top: 10px;
}
</style>
</head>
<!--左栏-->
<body class="cm-no-transition cm-1-navbar">
	<div id="cm-menu">
		<nav class="cm-navbar cm-navbar-primary">
		<div class="cm-flex" style="font-size: 34px; padding-left: 30px;">
			<span>Finance</span>
		</div>
		<div class="btn btn-primary md-menu-white" data-toggle="cm-menu"></div>
		</nav>
		<div id="cm-menu-content">
			<div id="cm-menu-items-wrapper">
				<div id="cm-menu-scroller"></div>
			</div>
		</div>
	</div>

	<!--顶栏-->
	<header id="cm-header"> <nav
		class="cm-navbar cm-navbar-primary">
	<div class="btn btn-primary md-menu-white hidden-md hidden-lg"
		data-toggle="cm-menu"></div>
	<!--顶栏菜单-->
	<div class="cm-flex" id="mainMenu"></div>

	<!--消息-->
	<div class="dropdown pull-right">
		<button class="btn btn-primary md-notifications-white"
			data-toggle="dropdown">
			<span class="label label-danger">23</span>
		</button>
		<div class="popover cm-popover bottom">
			<div class="arrow"></div>
			<div class="popover-content">
				<div style="padding: 10px">
					<a class="btn btn-success btn-block" href="#">Show me more...</a>
				</div>
			</div>
		</div>
	</div>
	<!--退出登录-->
	<div class="dropdown pull-right">
		<button class="btn btn-primary md-account-circle-white"
			data-toggle="dropdown"></button>
		<ul class="dropdown-menu">
			<li><a href="#"><i class="fa fa-fw fa-sign-out"></i> 退出登录</a></li>
		</ul>
	</div>
	</nav> </header>
	<div id="global">
		<div class="container-fluid" >
			<div class="row cm-fix-height" style="width:100%; height:768px; background-color : #fff ;" id="content">
			
			</div>
		</div>
	</div>
	<script type="text/javascript"
		src="static/bootstrap-3.3.7-dist/js/jquery-3.2.1.min.js"></script>
	<script type="text/javascript"
	src="static/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
	<script type="text/javascript"
		src="static/bootstrap-table/bootstrap-table.min.js"></script>
	<script src="static/bootstrap-table/bootstrap-table-zh-CN.min.js"></script>
	<script type="text/javascript"
	src="static/bootstrap-table/bootstrap-table-treegrid.js"></script>
	<!-- bootstrap表单验证 -->
	<script type="text/javascript" src="static/bootstrap-3.3.7-dist/js/bootstrapValidator.min.js"></script>
	<!-- 日期插件-->
	<script type="text/javascript" src="static/plugins/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript"
		src="static/bootstrap-table/jquery.treegrid.min.js"></script>
	<script type="text/javascript"
		src="static/plugins/jquery-ui/jquery-ui.min.js"></script>
	<script type="text/javascript"
	src="static/sweealter/dist/sweetalert.min.js"></script>
	<script src="static/assets/js/jquery.mousewheel.min.js"></script>
	<script src="static/assets/js/jquery.cookie.min.js"></script>
	<script src="static/assets/js/fastclick.min.js"></script>
	<script src="static/assets/js/bootstrap.min.js"></script>
	<script src="static/ztree/jquery.ztree.core.min.js"></script>
	<script src="static/ztree/jquery.ztree.excheck.min.js"></script>
	<script type="text/javascript"
		src="static/ztree/jquery.ztree.exedit.min.js"></script>
	<script>
	
		$(function() {
			$.ajax({url : "menu/main",
						success : function(data) {
							var menuList = data.result;

							for ( var i in menuList) {
								if (menuList[i].parentId == 0
										&& menuList[i].isShow == 0) {
									var mainMenu = '<button id="cm-search-btn" class="btn btn-primary" style="width: 130px;font-size: 16px;letter-spacing: 3px;" onclick="showLeftMenu('
											+ menuList[i].id
											+ ')">'
											+ menuList[i].name + '</button>';
									$("#mainMenu").append(mainMenu)
								}
							}

						}
					})
		})

		function showLeftMenu(id) {
			$.ajax({url : "menu/main",
						success : function(data) {
							$("#leftMenu").html("")
							var menuList = data.result;
							var menu = '<ul class="cm-menu-items" >';
							for ( var i in menuList) {
								if (menuList[i].parentId == id
										&& menuList[i].isShow == 0
										&& menuList[i].parentId != 0) {
									menu += '<li class="cm-submenu" ><a class="sf-window-layout">'
											+ menuList[i].name
											+ '<span class="caret"></span></a><ul>';
									for ( var j in menuList) {
										if (menuList[i].id == menuList[j].parentId
												&& menuList[j].isShow == 0) {
											menu += '<li><a href="javascript:void(0)" onclick="toPage(\''
													+ menuList[j].href
													+ '\')">'
													+ menuList[j].name
													+ '</a></li>';
										}
									}
									menu += "</ul></li>";
								}
							}
							menu += "</ul>";
							$("#cm-menu-scroller").html(menu);
							window.FIN.init();

						}
					})
		}

		//不能修改！不能刪除 ！  非常重要！
		window.FIN = {
			init : function() {
				var a = 0;
				var c = this;
				$(".cm-submenu ul").click(function(f) {
					f.stopPropagation()
				});
				$("#cm-menu-scroller").scroll(this.hidePopover);
				$("[data-toggle='cm-menu']").click(this.toggle);
				$("#cm-menu-backdrop").click(function() {
					$("body").removeClass("cm-menu-toggled")
				});
				$("#cm-menu-scroller").mousewheel(function(h) {
					var i = CM.config.navbarHeight + 1;
					var g = h.deltaY * i + a;
					var f = -$(window).height() + i;

					$(".cm-menu-items > li, .cm-submenu.open > ul").each(function() {
								f += $(this).height()
							});
					g = Math.max(Math.min(g, 0), -i
							* Math.ceil(f / i));
					g = Math.min(g, 0);
					$(".cm-menu-items").css("transform",
							"translateY(" + g + "px)");
					a = g;
					c.hidePopover();
					return false
				});

				$("#cm-menu a").click(function() {
					var f = CM.getState();
					var e = $(this).attr("href");
					if (e) {
						if (f.mobile) {
							$("body").removeClass("cm-menu-toggled");
							$.cookie("cm-menu-toggled", false, {
								path : "/"
							})
						}

						if (!$(this).parents(".cm-submenu").size()) {
							$(".cm-menu-items li").removeAttr("style");
							$(".cm-submenu").removeClass("open")
						}
					}
				});
				$(".cm-submenu").click(function(k, j, g) {
					var f = $(this);
					var i = CM.getState();
					if ((!i.mobile) && (!i.open)) {
						c.setPopover(f);
						return false
					}
					var h = f.hasClass("open");
					$(".cm-submenu").removeClass("open");
					$(".cm-menu-items li").removeAttr("style");
					if (!h) {
						f.addClass("open");
						f.nextAll().css(
								"transform",
								"translateY("
										+ f.children("ul").height()
										+ "px)")
					}
				});
				var d = CM.getState();
				if ((!d.mobile) && (!d.open)) {
					$(".cm-submenu.pre-open").removeClass("pre-open")
				} else {
					var b = $(".cm-submenu.pre-open");
					b.nextAll().css("transform",
							"translateY(" + b.children("ul").height() + "px)");
					b.addClass("open").removeClass("pre-open")
				}
			},
			hidePopover : function() {
				$("#cm-submenu-popover").removeClass("open")
			},
			setPopover : function(r) {
				var b = $("#cm-submenu-popover");
				var g = b.hasClass("open");
				var k = r.hasClass("popen");
				$(".cm-submenu").removeClass("popen");
				if (k && g) {
					this.hidePopover();
					return true
				}
				$("#cm-submenu-popover ul").html(r.find("ul").html());
				var e = 10;
				var i = $(window).height() - e;
				var q = $("#cm-submenu-popover").find(".arrow");
				var f = b.find(".popover").height();
				var j = r.position().top + CM.config.navbarHeight * 1.5 - f / 2;
				var n = j + f;
				q.show();
				if (n > i) {
					var c = n - i;
					j -= c;
					q.css("top", f / 2 + c)
				} else {
					if (j < e) {
						var c = j - e;
						j -= c;
						q.css("top", f / 2 + c)
					} else {
						q.css("top", "50%")
					}
				}
				if (q.position().top > f) {
					q.hide()
				}
				b.css("top", j);
				r.addClass("popen");
				if (!g) {
					$("#cm-submenu-popover [data-toggle='dropdown']").click()
				}
			},
			toggle : function() {
				$(".container-fluid").addClass("animate");
				$("body").toggleClass("cm-menu-toggled");
				var a = CM.getState();
				if (!a.mobile) {
					$(".cm-submenu").removeClass("open");
					$(".cm-menu-items li").removeAttr("style");
					$(window).resize();
					$.cookie("cm-menu-toggled", (!a.open), {
						path : "/"
					})
				} else {
					$.cookie("cm-menu-toggled", false, {
						path : "/"
					});
					a.open ? CM.preventScroll.enable() : CM.preventScroll
							.disable()
				}
			}

		}

		function toPage(href) {
			$.ajax({
				url : href,
				success : function(data) {
					$("#content").html(data)
				}
			})
		}
		
		//path:jsp页面, boxId:要被嵌入jsp页面的 div
		function loadPage(path,boxId){
			//页面加载完毕，加载页面
				$.ajax({
					url:path,
					type:'get',
					success:function(dt){
						$(boxId).html(dt);
					}
				});
		}

	</script>
	<script type="text/javascript" src="static/assets/js/clearmin.min.js"></script>
	<script type="text/javascript" src="static/assets/js/demo/home.js"></script>
</body>

</html>